const path = require('path');
const HotModuleReplacementPlugin = require('webpack/lib/HotModuleReplacementPlugin');

module.exports = {
  entry: {
    app: [
      './src/vendor.js',
      './src/app.js',
    ],
  },
  mode: 'development',
  output: {
    path: path.resolve(__dirname, 'www'),
    filename: 'app.bundle.js',
  },
  module: {
    rules: [{
        test: /\.js?$/,
        exclude: /node_modules/,
        loader: 'babel-loader',
        query: {
           presets: ['env', 'stage-0']
        }
    }]
  },
  plugins: [
    new HotModuleReplacementPlugin()
  ],
  devServer: {
    host: 'localhost',
    port: 8081,
    contentBase: path.resolve(__dirname, './www'),
    watchContentBase: true,
    progress: true,
    compress: true,
    hot: true,
    open: true,
    historyApiFallback: {
      disableDotRule: true
    },
    watchOptions: {
      ignored: /node_modules/
    },
    overlay: {
      warnings: true,
      errors: true
    }
  }
}